}
else
{
- ostree_repo_transaction_set_ref (pull_data->repo, pull_data->remote_name, ref, checksum);
-
+ gboolean is_mirror = (pull_data->flags & OSTREE_REPO_PULL_FLAGS_MIRROR) > 0;
+ ostree_repo_transaction_set_ref (pull_data->repo, is_mirror ? NULL : pull_data->remote_name, ref, checksum);
}
}
/**
* OstreeRepoPullFlags:
* @OSTREE_REPO_PULL_FLAGS_NONE: No special options for pull
+ * @OSTREE_REPO_PULL_FLAGS_MIRROR: Write out refs suitable for mirrors
*/
typedef enum {
- OSTREE_REPO_PULL_FLAGS_NONE
+ OSTREE_REPO_PULL_FLAGS_NONE,
+ OSTREE_REPO_PULL_FLAGS_MIRROR
} OstreeRepoPullFlags;
gboolean ostree_repo_pull (OstreeRepo *self,
#include "otutil.h"
static gboolean opt_disable_fsync;
+static gboolean opt_mirror;
static GOptionEntry options[] = {
{ "disable-fsync", 0, 0, G_OPTION_ARG_NONE, &opt_disable_fsync, "Do not invoke fsync()", NULL },
+ { "mirror", 0, 0, G_OPTION_ARG_NONE, &opt_mirror, "Write refs suitable for a mirror", NULL },
{ NULL }
};
if (opt_disable_fsync)
ostree_repo_set_disable_fsync (repo, TRUE);
+ if (opt_mirror)
+ pullflags |= OSTREE_REPO_PULL_FLAGS_MIRROR;
+
if (strchr (argv[1], ':') == NULL)
{
remote = g_strdup (argv[1]);
assert_file_has_content baz/cow '^moo$'
echo "ok pull contents"
+cd ${test_tmpdir}
+mkdir mirrorrepo
+ostree --repo=mirrorrepo init --mode=archive-z2
+${CMD_PREFIX} ostree --repo=mirrorrepo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo
+${CMD_PREFIX} ostree --repo=mirrorrepo pull --mirror origin main
+${CMD_PREFIX} ostree --repo=mirrorrepo fsck
+$OSTREE show main >/dev/null
+echo "ok pull mirror"
+
cd ${test_tmpdir}
ostree --repo=ostree-srv/gnomerepo commit -b main -s "Metadata string" --add-detached-metadata-string=SIGNATURE=HANCOCK --tree=ref=main
${CMD_PREFIX} ostree --repo=repo pull origin main